public class WatermarkDecorator implements Converter {
    private final Converter converter;
    private final String watermarkText;
    
    public WatermarkDecorator(Converter converter, String watermarkText) {
        this.converter = converter;
        this.watermarkText = watermarkText;
    }
    
    @Override
    public boolean support(String sourceFormat, String targetFormat) {
        return converter.support(sourceFormat, targetFormat);
    }
    
    @Override
    public void convert(File source, File target) throws ConversionException {
        converter.convert(source, target);
        addWatermark(target);
    }
    
    private void addWatermark(File file) {
        try {
            if (file.getName().endsWith(".docx")) {
                addWordWatermark(file);
            } else if (file.getName().endsWith(".pdf")) {
                addPdfWatermark(file);
            }
        } catch (Exception e) {
            throw new ConversionException("添加水印失败", e);
        }
    }
    
    private void addWordWatermark(File file) {
        // 实现Word文档添加水印的逻辑
    }
    
    private void addPdfWatermark(File file) {
        // 实现PDF文档添加水印的逻辑
    }
} 